package edu.sctu.xialei.May.day20150526two;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by Administrator on 5/26/2015.
 */
public class HashMapAndList {

    public HashMap<Integer,Classmates>[] creat(int size){

        List list = new ArrayList<HashMap>();

        for (int i = 0; i < size; i++) {
            HashMap<Integer,Classmates> map = new HashMap<Integer,Classmates>();

            for (int j = 10; j < 15; j++) {
                map.put(j,new Classmates());
            }

            list.add(map);
        }

        HashMap []map = new HashMap[list.size()];

        for (int i = 0; i < list.size(); i++) {
            map[i] = (HashMap) list.get(i);
        }
        return map;
    }


    public HashMap<Integer,Classmates>[] setValue(HashMap<Integer,Classmates>[] mapArray ){

        for (int i = 0; i < mapArray.length; i++) {

            for (int j = 10; j < 15; j++) {
                mapArray[i].get(j).name = "夏磊" + j;
                mapArray[i].get(j).num = j;
                mapArray[i].get(j).sex = "男";
            }
        }
        return mapArray;
    }
}
